fix(colab): Add linter for malformed lists in generated notebooks - #3947
fix(colab): Add linter for malformed lists in generated notebooks#3947ribhuji wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3947
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@albanD, could you please approve the workflow run for this draft PR? The current commit intentionally contains only the new Lintrunner check. The job is expected to fail with 14 diagnostics across the 10 tutorials documented in #3946, which will validate that the check detects the existing issues. Once that run is recorded, I’ll push a second commit fixing those violations. This will preserve both the detection run and the final passing run in the PR history. Thank you! |
|
Hey @albanD, bumping this up! |
|
Sorry, I don't really have a lot of time to review things here. What is this one about? |
Fixes #3946
Description
Some list structures in Sphinx-Gallery tutorial sources render correctly in the HTML documentation but become malformed after conversion to Markdown in the generated Google Colab notebooks.
This PR adds a repository-local
TUTORIAL_MARKUPLintrunner check that detects the two source patterns responsible for the problems documented in #3946:The checker only examines Sphinx-Gallery narrative content from module docstrings and gallery comment blocks. It accounts for valid nested lists, reStructuredText directives, and list tables to avoid reporting those as violations.
Validation strategy
This draft is being built in two commits so the Lintrunner behavior can be verified directly in GitHub Actions:
The expected CI result is 14 diagnostics across exactly the 10 tutorials documented in [BUG] - Incorrect list rendering in Google Colab tutorials #3946, with no additional tutorial files reported.
The subsequent CI run should pass with no
TUTORIAL_MARKUPdiagnostics.Local validation
python3 -m unittest discover -s tools/linter/tests -p 'test_*.py' lintrunner --all-files --take TUTORIAL_MARKUPThe unit test suite currently passes all eight tests. The complete linter scan reports 14 diagnostics across the 10 affected tutorial files and reports no other tutorial files.
Checklist